package cn.touna.jss.modules.third.linkface.enums;

/**
 * Created by wuwc on 2017/9/1.
 */
public enum LinkFaceEnum {

    PHOTO_SERVICE_ERROR("PHOTO_SERVICE_ERROR", "公安数据源服务出错"),
    ENCODING_ERROR("ENCODING_ERROR", "参数非UTF-8编码"),
    DOWNLOAD_TIMEOUT("DOWNLOAD_TIMEOUT", "网络地址获取超时"),
    DOWNLOAD_ERROR("DOWNLOAD_ERROR", "网络地址获取失败"),
    WRONG_LIVENESS_DATA("WRONG_LIVENESS_DATA", "活体数据 出错"),
    NO_FACE_DETECTED("NO_FACE_DETECTED", "图片未检测出人脸 "),
    INVALID_ARGUMENT("INVALID_ARGUMENT", "请求参数错误"),
    UNAUTHORIZED("UNAUTHORIZED", "账号或密钥错误"),
    KEY_EXPIRED("KEY_EXPIRED", "账号过期"),
    RATE_LIMIT_EXCEEDED("RATE_LIMIT_EXCEEDED", "调用频率超出限额"),
    NO_PERMISSION("NO_PERMISSION", "无调用权限"),
    NOT_FOUND("NOT_FOUND", "请求路径错误"),
    INTERNAL_ERROR("INTERNAL_ERROR", "服务器内部错误"),;


    private String code;

    private String decs;

    private LinkFaceEnum(String code, String decs) {
        this.code = code;
        this.decs = decs;
    }

    public String getCode() {
        return code;
    }

    public String getDecs() {
        return decs;
    }

    public static LinkFaceEnum getDesc(String code) {
        for (LinkFaceEnum cqr : LinkFaceEnum.values()) {
            if (cqr.getCode().equals(code)) {
                return cqr;
            }
        }
        return null;
    }

    public boolean equals(String code) {
        return this.code != null && this.code.equals(code);
    }


    public static void main(String[] args) {

        System.out.println(LinkFaceEnum.getDesc("DOWNLOAD_ERROR").getDecs());
        ;

    }
}

